package cn.tedu_02;

import java.util.Scanner;

public class TextRegex {

    public static void main(String[] args) {

        method();
        method2();


    }

    private static void method2() {
        System.out.println("请输入您的身份证号码:");

        String input = new Scanner(System.in).nextLine();
        String regex = "\\d{17}[9X]";

        if(input.matches(regex)){
            System.out.println("恭喜您输入正确");
        }else{
            System.out.println("输入错误");
        }

    }

    private static void method() {
        System.out.println("请输入您的身份证号码:");
        String input =new Scanner(System.in).nextLine();

        String regex = "\\d{17}[0-9X]";
        if(input.matches(regex)){
            System.out.println("恭喜您,输入正确!");
        }else{
            System.out.println("输入不正确");
        }
    }

}
